﻿using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    struct Stxp
    {
        private Ts ts;
        private int twpHeight;
        private short bls;
        private short sss;
        private byte uls;
        private byte bFamily;
        private byte bCharSet;

        public void Read(BinaryReader reader)
        {
#if DEBUG
            ReadWriteChecker.CheckStruct((ref Stxp t, BinaryReader r) => t.Read(r),
                                         (ref Stxp t, BinaryWriter w) => t.Write(w), reader, ref this);
#endif
            this.twpHeight = reader.ReadInt32();
            ts.Read(reader);
            this.bls = reader.ReadInt16();
            this.sss = reader.ReadInt16();
            this.uls = reader.ReadByte();
            this.bFamily = reader.ReadByte();
            this.bCharSet = reader.ReadByte();
            var unused = reader.ReadByte();
        }

        public void Write(BinaryWriter writer)
        {
           writer.Write(twpHeight);
            ts.Write(writer);
            writer.Write(bls);
            writer.Write(sss);
            writer.Write(uls);
            writer.Write(bFamily);
            writer.Write(bCharSet);
            writer.Write((byte)0);
        }
    }
}
